# weather file system
# Author: jerome
# create: 2023-09-09
# update: 2023-09-09
# version: 1.0

# Set the file name of your jar package:
JAR_PKG = work3.jar
# Set your entry point of your java app:
ENTRY_POINT = com.jerome.election.server.MemberServer
# Do you need the res directory? If your program has pictures, documents, etc.,
# It is best to put it in the res directory.
# yes: required; no: not required
RES_DIR = no

SOURCE_FILES = \
src/main/java/com/jerome/election/http/server/HttpServer.java \
src/main/java/com/jerome/election/http/server/HttpHandler.java \
src/main/java/com/jerome/election/server/ContextUtil.java \
src/main/java/com/jerome/election/server/MemberServer.java \
src/main/java/com/jerome/election/util/JsonUtil.java \
src/main/java/com/jerome/election/server/PaxosMethodEnum.java \
src/main/java/com/jerome/election/log/Logger.java \
src/main/java/com/jerome/election/storage/RingBuffer.java \
src/main/java/com/jerome/election/test/M1.java \
src/main/java/com/jerome/election/util/LockUtil.java \
src/main/java/com/jerome/election/util/DateUtil.java \
src/main/java/com/jerome/election/test/M7.java \
src/main/java/com/jerome/election/config/ConfigUtil.java \
src/main/java/com/jerome/election/json/JsonParser.java \
src/main/java/com/jerome/election/http/server/HttpTask.java \
src/main/java/com/jerome/election/config/Config.java \
src/main/java/com/jerome/election/http/HttpMethodEnum.java \
src/main/java/com/jerome/election/util/ThreadPoolFactory.java \
src/main/java/com/jerome/election/log/LoggerHandler.java \
src/main/java/com/jerome/election/http/Request.java \
src/main/java/com/jerome/election/http/Response.java \
src/main/java/com/jerome/election/lamport/LamportClock.java \
src/main/java/com/jerome/election/test/M5.java \
src/main/java/com/jerome/election/server/PaxosUtil.java \
src/main/java/com/jerome/election/test/M2.java \
src/main/java/com/jerome/election/http/HttpMessageParser.java \
src/main/java/com/jerome/election/server/paxos/PaxosMessage.java \
src/main/java/com/jerome/election/storage/DBF.java \
src/main/java/com/jerome/election/util/ReflectUtil.java \
src/main/java/com/jerome/election/http/HttpConstant.java \
src/main/java/com/jerome/election/lamport/Event.java \
src/main/java/com/jerome/election/storage/ExpiringMap.java \
src/main/java/com/jerome/election/server/paxos/Learner.java \
src/main/java/com/jerome/election/constants/AppConstant.java \
src/main/java/com/jerome/election/sync/CenterServerHandler.java \
src/main/java/com/jerome/election/storage/FileUtil.java \
src/main/java/com/jerome/election/server/paxos/ProposeAccepter.java \
src/main/java/com/jerome/election/json/JsonSerializer.java \
src/main/java/com/jerome/election/server/config/MemberConfig.java \
src/main/java/com/jerome/election/sync/SyncClient.java \
src/main/java/com/jerome/election/sync/SyncClientHandler.java \
src/main/java/com/jerome/election/server/handler/ClientHandler.java \
src/main/java/com/jerome/election/server/handler/MemberHandler.java \
src/main/java/com/jerome/election/enums/ClassEnum.java \
src/main/java/com/jerome/election/test/M4.java \
src/main/java/com/jerome/election/test/M6.java \
src/main/java/com/jerome/election/json/JsonParseException.java \
src/main/java/com/jerome/election/enums/ApiUrlEnum.java \
src/main/java/com/jerome/election/server/handler/ServerHandler.java \
src/main/java/com/jerome/election/sync/CenterServer.java \
src/main/java/com/jerome/election/server/MemberStateEnum.java \
src/main/java/com/jerome/election/test/BuildMakeFile.java \
src/main/java/com/jerome/election/http/client/HttpClient.java \
src/main/java/com/jerome/election/test/M3.java \
src/main/java/com/jerome/election/http/HttpStatus.java \
src/main/java/com/jerome/election/sync/SyncVo.java \
# Set your java compiler here:
JAVAC = javac

JFLAGS = -encoding UTF-8

# make build: Compile and generate java classes in the bin directory.
# make clean: Clean up the compilation results for recompilation
# make rebuild: Clean up the compilation results and recompile.
# make run: After make, you can view the running results through make run.
# make jar: Generate an executable jar package.

#############The following content is not recommended to be modified####################

vpath %.class bin
vpath %.java src

# show help message by default
Default:
	@echo "make new: new project, create src, bin, res dirs."
	@echo "make build: build project."
	@echo "make clean: clear classes generated."
	@echo "make rebuild: rebuild project."
	@echo "make run: run your app."
	@echo "make jar: package your project into a executable jar."

build:
	$(JAVAC) -cp bin -d bin $(JFLAGS) $(SOURCE_FILES)
rebuild: clean build

.PHONY: new clean run jar

new:
ifeq ($(RES_DIR),yes)
	mkdir -pv src bin res
else
	mkdir -pv src bin
endif

clean:
	rm -frv bin/*

run:
	java -cp bin $(ENTRY_POINT)

jar:
ifeq ($(RES_DIR),yes)
	jar cvfe $(JAR_PKG) $(ENTRY_POINT)  -C bin . res
else
	jar cvfe $(JAR_PKG) $(ENTRY_POINT) -C bin .
endif
